class TaskSqlMap(object):
    DEPT_LIST = "select dept_id, dept_name, dept_tel, dept_hierarchy, code, leader, remarks from aoa_dept"
    organization_list_name = "select real_name from aoa_user where user_id={user_id}"
    get_dept_manager = "select t1.dept_id,t2.real_name as manager_name from aoa_dept as t1 inner join aoa_user as t2 on t1.deptmanager=t2.user_id where dept_name='{dept_name}'"
    dept_name_all = "select dept_name from aoa_dept"
    user_dept = "select t1.dept_name from aoa_dept as t1 inner join aoa_user as t3 on t1.dept_id=t3.dept_id where t3.user_id={user_id}"
    dept_people = "select t1.user_id,t1.real_name,t1.user_edu,t1.sex,t1.hire_time,t1.img_path,t4.name as position_name,t3.role_name,t2.dept_name,t2.children_id from aoa_user as t1 inner join aoa_dept as t2 on t1.dept_id=t2.dept_id inner join aoa_role_ as t3 on t3.role_id=t1.role_id inner join aoa_position as t4 on t4.position_id=t1.position_id"
    # dept_people = "select t1.user_id,t1.real_name,t1.user_edu,t1.sex,t1.hire_time,t1.img_path,t4.name as position_name,t3.role_name,t2.dept_name,t2.children_id from aoa_user as t1 inner join aoa_dept as t2 on t1.dept_id=t2.dept_id inner join aoa_role_ as t3 on t3.role_id=t1.role_id inner join aoa_position as t4 on t4.position_id=t1.position_id where t1.dept_id={dept_id} or t1.dept_id=any(select dept_id from aoa_dept where children_id={dept_id})"

    subject_top = "select dept_id,dept_name from aoa_dept where children_id is null"
    subject_mid = "select dept_id,dept_name from aoa_dept where children_id={dept_id}"
    subject_down = "select t1.dept_id,t1.dept_name,t2.dept_id as last_dept_id from aoa_dept as t1 inner join aoa_dept as t2 on t1.children_id=t2.dept_id where t1.children_id is not null and t1.children_id!=1"

    FILTER_PARAMS = {
        "query_str": "dept_name like '%{query_str}%'",
        "query_str_name": "t1.real_name like '%{query_str_name}%'"
    }

